package org.jmetrix.et.sample.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.jmetrix.et.ExecutionTimeAspect;

/**
 * @author Konstantin Kuzmin
 * @version $Revision$
 * @since 01.10.11
 */
@Aspect
public class ComplexMethodExecutionTimeAspect extends ExecutionTimeAspect {
    @Override
    protected String getGroup(ProceedingJoinPoint pjp) {
        return pjp.getSignature().getName();
    }

    @Around("call (public void org.jmetrix.et.sample.SomeClass.someComplexMethod(..))")
    public Object measureComplexMethod(final ProceedingJoinPoint pjp) throws Throwable {
        return super.measure(pjp);
    }

    @Around("call (public void org.jmetrix.et.sample.SomeClass.someMethod1(..))")
    public Object measureMethod1(final ProceedingJoinPoint pjp) throws Throwable {
        return super.measure(pjp);
    }

    @Around("call (public void org.jmetrix.et.sample.SomeClass.someMethod2(..))")
    public Object measureMethod(final ProceedingJoinPoint pjp) throws Throwable {
        return super.measure(pjp);
    }

    @Around("call (public void org.jmetrix.et.sample.SomeClass.throwExceptionMethod(..))")
    public Object measureMethodWhichThrowsException(final ProceedingJoinPoint pjp) throws Throwable {
        return super.measure(pjp);
    }
}
